package com.colin.productservice11001.controller;

import com.colin.common.response.R;
import com.colin.productservice11001.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProductController {

    @Autowired
    private ProductService productService;

    /**
     * 修改商品库存
     * @param productId 商品id
     * @param count 需要更改的库存数量
     * @return R 修改结果
     *         data: boolean
     *
     */
    @PutMapping("/product/{productId}/{count}")
    public R<Boolean> changeInventory(
            @PathVariable Integer productId,
            @PathVariable Integer count
    ) {
        return productService.changeInventory(productId, count);
    }
}
